package com.dbb

import java.util.ArrayList;
import java.util.List;

class GroupInfo {
	Ctn ctn
	Float price = 0f
	Integer ctnNum = 0
	GroupInfo realGroupInfo = null
	static belongTo = [shipment : Shipment]
    static constraints = {
    }
	
	String toString() {
		return ctn.toString() + " " + ctnNum
	}
	
	public Float getTotalPrice(){
		return getTotalPairs() * price;
	}
	
	public Integer getTotalPairs(){
		return ctn.getPrs() * ctnNum;
	}
	
	public Float getTotalNw(){
		return ctn.getNetWeight() * ctnNum;
	}
	
	public Float getTotalGw(){
		return ctn.getGrossWeight() * ctnNum;
	}
	
	public Float getTotalCbm() {
		return ctn.getCbm() * ctnNum;
	}
	
	static List<GroupInfo> init() {
		List<GroupInfo> GroupInfos = new ArrayList<GroupInfo>();
		List<Ctn> ctns = Ctn.init();
		GroupInfos.add(new GroupInfo(ctns.get(0), 14.3f, 70));
		GroupInfos.add(new GroupInfo(ctns.get(1), 14.3f, 40));
		GroupInfos.add(new GroupInfo(ctns.get(2), 10.6f, 36));
		GroupInfos.add(new GroupInfo(ctns.get(3), 10.6f, 10));
		GroupInfos.add(new GroupInfo(ctns.get(4), 11.5f, 100));
		GroupInfos.add(new GroupInfo(ctns.get(5), 11.5f, 60));
		GroupInfos.add(new GroupInfo(ctns.get(6), 11.7f, 60));
		GroupInfos.add(new GroupInfo(ctns.get(7), 11.7f, 36));
		GroupInfos.add(new GroupInfo(ctns.get(8), 13.3f, 60));
		GroupInfo GroupInfo = new GroupInfo(ctns.get(9), 13.3f, 40);
		GroupInfo.setRealGroupInfo(new GroupInfo(ctns.get(9), 13.3f, 60));
		GroupInfos.add(GroupInfo);
		return GroupInfos;
	}

}
